package duckHunter.app;

import java.io.IOException;
import java.io.InputStream;

import javax.microedition.media.Manager;
import javax.microedition.media.MediaException;
import javax.microedition.media.Player;

/**
 * Musi
 * @author AYARI
 *
 */
public class Musique implements Runnable {
	private Player player;


	public Musique(String file) throws IOException, MediaException {

		InputStream is = getClass().getResourceAsStream(file);
		player = Manager.createPlayer(is, "audio/x-tone-seq");

	}

	public void run() {

	}

	public void start() throws MediaException {
		Thread t = new Thread(this);
		t.start();
		    player.setLoopCount(0);
			player.start();
	}
	public void stop(){
		try {
			player.stop();
		} catch (MediaException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
